class Student:
    name = ''
    age = 0

    # 构造函数,用于初始化，当实例化对象时会自动调用
    def __init__(self, name, age):
        print('---初始化---')
        self.name = name
        self.age = age

    def eat(self):
        print(self.name, '干饭啦。。。')


# 实例化一个对象
stu1 = Student("Rose", 20)
stu2 = Student("Luck", 18)
print(stu1.name, stu1.age)
print(stu2.name, stu2.age)
stu1.eat()
stu2.eat()
